#!/usr/bin/python
import os
import sys
import ConfigParser

config = ConfigParser.SafeConfigParser()
config.read(sys.argv[1])

skipfeatures	= config.get('setting', 'skipfeatures')
attrifile	= config.get('setting', 'attrifile')

attriname = {}
with open(attrifile, 'r') as fattri:
	attributes = fattri.readlines()
	for attri in attributes:
		line = attri.split(';')
		if len(line) == 2:
			attrisym = line[0].strip()
			index = int(line[1].strip())
			attriname[index] = attrisym

skipatt = skipfeatures.strip().split(':')

writenames = 'attribute.txt'
if len(sys.argv) >=3:
	writenames = sys.argv[2]
with open(writenames, 'w') as fout:
	for i in range(0, len(skipatt)):
		line = attriname[int(skipatt[i]) + 1] + '\n'
		fout.write(line)
		print line.strip()
